home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / dev / misc / BoulderEngine.lha / source / graftalas.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-30  |  980 b   |  49 lines

  1. #include "GRAFKERNEL.C"
  2. #include "JOYSTICK.C"
  3. #include "RND.C"
  4. extern long rnd();
  5. /* Graftalas paparcio sakele */
  6.  
  7. Three()
  8. {
  9. int b[100];
  10. int k,n,x=0,y=0,z=0,newx,newy;
  11. static int a[4][3][4]={
  12. { {0,0,0,0},{0,20,0,0},{0,0,0,0}       } , 
  13. { {85,0,0,0},{0,85,11,70},{0,-10,85,0} } ,
  14. { {31,-41,0,0},{10,21,0,21},{0,0,30,0} } ,
  15. { {-29,40,0,0},{10,19,0,56},{0,0,30,0} } };
  16.  
  17. while (!fire())
  18. {
  19.  for(k=1;k<100;++k)
  20.  {
  21.   b[k]=rnd(10);
  22.    if(b[k]>3) {b[k]=1;}
  23.  }
  24.  for (k=1;k<100;++k)
  25.  {
  26.  newx=(a[b[k]][0][0]*x+a[b[k]][0][1]*y+a[b[k]][0][2]*z)/100+a[b[k]][0][3];
  27.  newy=(a[b[k]][1][0]*x+a[b[k]][1][1]*y+a[b[k]][1][2]*z)/100+a[b[k]][1][3];
  28.     z=(a[b[k]][2][0]*x+a[b[k]][2][1]*y+a[b[k]][2][2]*z)/100+a[b[k]][2][3];
  29.  
  30.  x=newx; y=newy;
  31.  
  32.   plot(310-x+z,390-y);
  33.  }
  34. }
  35. }
  36. main()
  37. {
  38. pasiruosk();
  39. SetRast(&rastport,0L);
  40. SetAPen(&rastport,1L);
  41. Move(&rastport,0L,0L); Draw(&rastport,629L,0L);
  42. Draw(&rastport,629L,399L); Draw(&rastport,0L,399L);
  43. Draw(&rastport,0L,0L);
  44.  
  45. rnd(-73456L);
  46. Three();
  47. FreeMemory();
  48. }
  49.